package com.nerve.android.cloudoffice.domain;

import java.util.Date;

/**
 * @project: cloudOffice
 * @file: Message.java
 * @package: com.nerve.cloudoffice.domain
 * @description:
 *	在这里，只保存了用户名，还有用户id
 * @author: 集成显卡	1053214511@qq.com
				IBM GDC, zengxm@cn.ibm.com
 * @date&time: Aug 19, 2013
 * @change log:
 */
@SuppressWarnings("serial")
public class Message extends BaseEntity {
	private String fromUser;
	private String toUser;
	private int fromId;
	private int toId;
	
	private int groupId;
	
	private String message;
	private boolean read;
	private Date joinDate;
	
	public void buildDate(long time){
		joinDate = new Date(time);
	}
	
	public String getFromUser() {
		return fromUser;
	}
	public void setFromUser(String fromUser) {
		this.fromUser = fromUser;
	}
	public String getToUser() {
		return toUser;
	}
	public void setToUser(String toUser) {
		this.toUser = toUser;
	}
	public int getFromId() {
		return fromId;
	}
	public void setFromId(int fromId) {
		this.fromId = fromId;
	}
	public int getToId() {
		return toId;
	}
	public void setToId(int toId) {
		this.toId = toId;
	}
	public String getMessage() {
		return message;
	}
	public void setMessage(String message) {
		this.message = message;
	}
	public boolean isRead() {
		return read;
	}
	public void setRead(boolean read) {
		this.read = read;
	}
	public Date getJoinDate() {
		return joinDate;
	}
	public void setJoinDate(Date joinDate) {
		this.joinDate = joinDate;
	}
	public int getGroupId() {
		return groupId;
	}
	public void setGroupId(int groupId) {
		this.groupId = groupId;
	}
	
	@Override
	public String toString() {
		return String.format("[Message fromUser=%1$s, toUser=%2$s, groupId=%3$d, message=%4$s]", 
				fromUser,
				toUser,
				groupId,
				message
				);
	}
}